package experimentUI;

import javax.swing.*;
import java.awt.*;

public class resistanceChangeFrame extends JFrame {
    final Integer[] elementOfDigit = {0,1,2,3,4,5,6,7,8,9};
    final Integer[] elementOfVal = {-1,0,1,2,3,4};
    public JComboBox<Integer> jComboBoxOfDigit = new JComboBox<>(elementOfDigit);
    public JComboBox<Integer> jComboBoxOfVal = new JComboBox<>(elementOfVal);
    public JButton confirm=new JButton("确认");

    public JLabel resistanceNum=new JLabel("当前电阻" + new Double(0));
    public resistanceChangeFrame(String name){
        setLayout(new FlowLayout());
        setTitle(name);
        Container container=getContentPane();
        JLabel digit,val;
        digit=new JLabel("数值");
        val = new JLabel("*10^");
        container.add(digit);
        container.add(jComboBoxOfDigit);
        container.add(val);
        container.add(jComboBoxOfVal);
        container.add(confirm);
        container.add(resistanceNum);
        setVisible(true);
        setBounds(500,200,500,200);

    }

    class resistanceConboBox extends AbstractListModel<Integer> implements ComboBoxModel<Integer>{
        Integer selectedItem=null;
        int[] nums;
        public int getSize(){
            return nums.length;
        }


        public Integer getElementAt(int index) {
            return nums[index];
        }

        public void setSelectedItem(Object item){
            selectedItem=(Integer)item;
        }
        public Object getSelectedItem(){
            return selectedItem;
        }
    }
}
